import Vue from "vue";
import VueRouter from "vue-router";
Vue.use(VueRouter);
// 路由表
const routes = [
  {
    path: "/login",
    name: "login",
    // 配置懒加载方式的路由
    component: () => import("@/views/login"),
  },
  {
    path: "/",
    // name: "layout" // 如果 父路由 有默认路由 ， 那它的 name没有意义，可以去掉
    component: () => import("@/views/layout"),
    children: [
      {
        path: '', // 默认子路由 只能有一个
        name: "home",
        component: () => import("@/views/layout/components/home"),
      },
      {
        path: "/qa",
        name: "qa",
        component: () => import("@/views/layout/components/qa"),
      },
      {
        path: "/video",
        name: "video",
        component: () => import("@/views/layout/components/video"),
      },
      {
        path: "/my",
        name: "my",
        component: () => import("@/views/layout/components/my"),
      },
    ],
  },
];

const router = new VueRouter({
  routes,
});

export default router;
